<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display" %>
<%@ page contentType="text/html;charset=utf-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Buscar Beneficiario</title>
<link href="../../css/jdeveloper.css" rel="stylesheet" media="screen"/>

<script language="javascript">
  function enviar(ruta){
    alert(ruta);
    document.frmlista.action=ruta;
    document.frmlista.submit();
  }
  
  function activarvalor(locacion1)
  {
    document.frmlista.action=locacion1;
    document.frmlista.submit();
  }
</script>

</head>
<body>

 <link href="<%= request.getContextPath() + "/css/bloques.css" %>" rel="stylesheet" type="text/css">
  
  <P></P>
  <form name="frmlista" action="<%= request.getContextPath() + "/admin/tile/AdicionDominio.jsp"%>" method="get">
    <DIV align="center">
     <logic:present name="listadominio">
      <table cellspacing="2" cellpadding="3" border="0" width="35%">
        <tr>
          <td class="titulosenblanco" align="center" colspan="2" width="21%">
            <STRONG>Tipo de Lista</STRONG>
          </td>
        </tr>
        <tr>
          <td class="celdatabla" width="21%">
            <STRONG>Nombre</STRONG>
          </td>
           <% String nomtvfl = (String)session.getAttribute("nombretvfl"); 
              if(nomtvfl!=null)
              {
           %>
                <td width="50%">
                  <input name="descripciontvfl"  Class="form" type="text" value="<%=nomtvfl%>"/>
                </td>
           <% }else
           {
           %>
              <td width="50%">
                  <input name="descripciontvfl"  Class="form" type="text" value=""/>
              </td>
           <%}%>   
           
           
        </tr>
        <tr>
          <td class="celdatabla" width="21%">
            <STRONG>Vigente</STRONG>
          </td>
          
          </td>
           <% String vigencia = (String)session.getAttribute("vigenciatvfl"); %>
            
                <td width="50%">
                <select class="form" name="vigenciatvfl">
           <% if(vigencia.equals("S"))
              {
          %>
                    <option selected="selected" value="S">Si</option>
                    <option  value="N">No</option>  
          <%  }else{
          %>
                    <option  value="S">Si</option> 
                    <option selected="selected"  value="N">No</option>  
          <%  }%>  
                </select>
         <td align="center" width="40%" class="celdatabla">
           <P>
             <%  String Ruta2 = "'"+request.getContextPath() + "/subprogramas/atributos/ActivarVFL.do'"; %>
             <input type="image" onclick="activarvalor(<%=Ruta2%>)" src="<%= request.getContextPath() + "/images/activar.gif" %>"/>
             <br/>
             <span>Activar Valores</span>
           </P>
           
</td>     
            
        </tr>
      </table>
      
      <br>
     
     <% vigencia = (String)session.getAttribute("vigenciatvfl");
        if(vigencia.equals("S"))
        {
     %> 
          <logic:present name="listadominio">
          <table>
            <tr>
              <td class="titulosenblanco" align="center" colspan="3">
                <STRONG>Atributos de la lista</STRONG>
              </td>
            </tr>
              <tr>
                  <td class="celdatabla" align="center">
                    <STRONG>Codigo</STRONG>
                  </td>
                  <td class="celdatabla" align="center">
                    <STRONG>Nombre</STRONG>
                  </td>
                  <td class="celdatabla" align="center">
                    <STRONG>Deshabilitar</STRONG>
                  </td>
              </tr>
              <% int i = 0; %>
              <logic:iterate id="mostrar" name="listadominio" type="com.cs.beneficios.business.model.ValorFlexibleVO">
                <% i++; %>
                <tr>
                    <td align="center">
                        <input name="codigo<%=i%>" maxlength="10" Class="form" type="text" size="10" value="<bean:write name="mostrar" property="codigoValor"/>"/>
                    </td>
                    <td align="center">
                        <input name="descripcionvf<%=i%>" maxlength="24" Class="form" type="text" size="30" value="<bean:write name="mostrar" property="descripcionvf"/>"/>
                    </td>
                    <td align="center">
                         <a href="<%=request.getContextPath() + "/EliminarVFL.do?CodigovflElim="+i%>"><img border="0" src="<%=request.getContextPath() + "/images/Delete.gif"%>"/></a>
                    </td>
                </tr>
             </logic:iterate>
          </table>
          </logic:present>
          <logic:notPresent name="listadominio">
            <div align="center">
            No hay valores para la lista
            </div>
          </logic:notPresent>
      <% }else
         {%>
             <font class="titulosenblanco">Lista Vacia</font>
             <logic:present name="listadominio">
             <% int i = 0; %>
                  <logic:iterate id="mostrar" name="listadominio" type="com.cs.beneficios.business.model.ValorFlexibleVO">
                    <% i++; %>
                    <tr>
                       
                        <td align="center">
                            <input type="hidden" name="descripcionvf<%=i%>" value='<bean:write name="mostrar" property="descripcionvf"/>'/>
                        </td>
                    </tr>
                 </logic:iterate>
            </logic:present>
            <P>
              <% }%>
              <br/>
              <% String Ruta4 = "'"+request.getContextPath() + "/ModificarValorFlex.do'"; %>
              <input type="button" value="Modificar" language="javascript" onclick="enviar(<%=Ruta4%>)"/>
              <%  String Ruta = "'"+request.getContextPath() + "/admin/tile/AdicionDominio.jsp'";
      %>
              <input type="SUBMIT" value="Agregar" />
              <input type="hidden" name="mostregresar" value="2"/>
              <%  String TipoValorFlex = (String)session.getAttribute("tipovalorflex"); %>
              <input type="hidden" name="codigotvfl" value="<%=TipoValorFlex%>"/>
              <%  
              String codAtri = (String)session.getAttribute("codsubpro");
              String Ruta3 = "'"+request.getContextPath() + "/BuscarAtributo.do'"; 
              %>
            <input type="hidden" name="accion" value="1"/>
            <input type="hidden" name="codigo" value="<%=codAtri%>"/>

            </P>
            <P>
              <input type="image" onclick="activarvalor(<%=Ruta3%>)" src="<%= request.getContextPath() + "/images/b_atras.gif" %>"/>
            </P>
       
       
     </logic:present>
     <logic:notPresent name="listadominio">
        <div align="center">
          <% String Ruta2 = "'"+request.getContextPath() + "/subprogramas/atributos/ActivarVFL.do'"; %>
          <input type="image" onclick="activarvalor(<%=Ruta2%>)" src="<%= request.getContextPath() + "/images/activar.gif" %>"/>
        </div>
        <div align="center" class="titulosenblanco">
          <P>No hay valores para la lista</P>
          <P><br>
          <% 
          String codAtri = request.getParameter("codatributo");
          String Ruta4 = "'"+request.getContextPath() + "/PropiedadesAtri.do'"; %>
          <input type="hidden" name="codatributo" value="<%=codAtri%>"/>
        <input type="image" onclick="activarvalor(<%=Ruta4%>)" src="<%= request.getContextPath() + "/images/b_atras.gif" %>"/>
          </P>
        </div>
     </logic:notPresent>
    </DIV>
    
  
    
  </form>
</body>
</html>
